package com.chaofan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chaofan.domain.User;
import com.chaofan.domain.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author 李超凡
 * @since 2022/1/14 17:28
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from t_user where phone=#{phone}")
    User selectByPhone(String phone);

    @Select("select * from t_user_info where userId=#{userId}")
    UserInfo selectUserInfoByUserId(Long userId);

    @Insert("insert into t_user_info values(null,#{userId},#{nick},#{avatar},#{sign},#{gender},#{birth},null,null)")
    void addUserInfo(UserInfo userInfo);
}
